package cn.kgc.tangcco.session;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/10/19 下午3:26
 */
@WebServlet(urlPatterns = "/session01")
public class Session01 extends HttpServlet {
    private static final long serialVersionUID = 8394246433147182220L;

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        System.out.println(session.getId());
        session.setAttribute("slogan","slogan");
        response.sendRedirect(request.getContextPath() + "/session02");
    }
}
